.Dd Oct 10, 2019
.Os "Open Babel" 3.1
.Dt obgrep 1 URM
.Sh NAME
.Nm obgrep
.Nd an advanced molecular search program using SMARTS
.Sh SYNOPSIS
.Nm
.Op Ar OPTIONS
.Ar SMARTS-pattern
.Ar filename
.Sh DESCRIPTION
The
.Nm
tool can be used to search for molecules inside
multi-molecule database files (e.g., SMILES, SDF, etc.) or across
multiple files.
.Sh OPTIONS
If only a filename is given,
.Nm
will attempt to guess the file type from the filename extension.
.Bl -tag -width flag
.It Fl c
Print the number of matches
.It Fl f
Full match, print matching-molecules only when the number of heavy
atoms is also equal to the number of atoms in the
.Ar SMARTS-pattern
.It Fl i Ar format
Specifies input and output format, see
.Xr obabel 1
for available formats
.It Fl n
Only print the name of the molecules
.It Fl t Ar #
Print a molecule only if the pattern occurs # times inside the molecule
.It Fl v
Invert the matching, print non-matching molecules
.El
.Sh EXAMPLES
Note that in all examples, the SMARTS pattern is enclosed in single
quotes '...' to ensure it is not changed by the shell.
.Pp
Print all the molecules with a methylamine group:
.Dl "obgrep 'CN' database.smi"
.Pp
Print all the molecules without a methylamine group:
.Dl "obgrep -v 'CN' database.smi"
.Pp
Print the number of molecules without a methylamine group:
.Dl "obgrep -v -c 'CN' database.smi"
.Pp
Print methylamine (if it exists in the file):
.Dl "obgrep -f 'CN' database.smi"
.Pp
Print methylamine and/or methanol (if they exist):
.Dl "obgrep -f 'C[N,O]' database.smi"
Print all molecules with aromatic carbon in all SMILES files in the
directory (i.e., *.smi)
.Dl "obgrep 'c' *.smi"
.Sh SEE ALSO
.Xr obabel 1 ,
.Xr obfit 1 ,
.Xr obrotate 1 .
.Pp
The web pages for Open Babel can be found at:
\%<\fBhttp://openbabel.org/\fR>
.Pp
A guide for constructing SMARTS patterns can be found at:
\%<\fBhttp://www.daylight.com/dayhtml/doc/theory/theory.smarts.html\fR>
.Sh AUTHORS
The obgrep program was contributed by
.An Fabien Fontaine
.Pp
.An -nosplit
Open Babel is developed by a cast of many, including current maintainers
.An Geoff Hutchison ,
.An Chris Morley ,
.An Michael Banck ,
and innumerable others who have contributed fixes and additions.
For more contributors to Open Babel, see
\%<\fBhttp://openbabel.org/wiki/THANKS\fR>
.Sh COPYRIGHT
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
.br
Some portions Copyright (C) 2001-2007 by Geoffrey R. Hutchison and
other contributors.
.Pp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
.Pp
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
